{% load static %}
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>
        {% block title %}
        {% endblock %}
    </title>
{#    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">#}
    <link rel="stylesheet" href="{% static 'js/bootstrap-5.1.3-dist/css/bootstrap.min.css' %}">

    <style>
        .navbar-brand {
            font-weight: bold;
        }
        .food-card {
            transition: transform 0.2s;
        }
        .food-card:hover {
            transform: translateY(-5px);
        }
        .stats-card {
            background: linear-gradient(45deg, #f8f9fa, #e9ecef);
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
        <div class="container">
            <a class="navbar-brand" href="{% url 'main:index' %}">🍽️ 每日美食选择器</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'main:index' %}">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'main:history' %}">历史记录</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'main:preferences' %}">偏好分析</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'main:food_library' %}">食物库</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'main:recipe_list' %}">做菜指南</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'main:caipu_list' %}">菜谱指南</a>
                    </li>

                </ul>
       <ul class="navbar-nav ms-auto">
  {% if request.user.is_authenticated %}
    <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle"
         href="#"
         id="userDropdown"
         role="button"
         data-bs-toggle="dropdown"
         aria-expanded="false">
        {{ request.user.username }}
      </a>
      <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="userDropdown">
        <li><a class="dropdown-item" href="{% url 'user:center' %}">个人中心</a></li>
        <li><a class="dropdown-item" href="{% url 'user:change_password' %}">修改密码</a></li>
        <li><hr class="dropdown-divider"></li>
        <li><a class="dropdown-item" href="{% url 'user:logout' %}">退出</a></li>
      </ul>
    </li>
  {% else %}
    <li class="nav-item">
      <a class="nav-link" href="{% url 'user:login' %}">登录</a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="{% url 'user:register' %}">注册</a>
    </li>
  {% endif %}
</ul>
{#                <ul class="navbar-nav">#}
{#                    {% if user.is_authenticated %}#}
{#                    <li class="nav-item">#}
{#                        <span class="navbar-text me-3">欢迎, {{ user.username }}</span>#}
{#                    </li>#}
{#                    <li class="nav-item">#}
{#                        <a class="nav-link" href="{% url 'logout' %}">退出</a>#}
{#                    </li>#}
{#                    {% else %}#}
{#                    <li class="nav-item">#}
{#                        <a class="nav-link" href="{% url 'login' %}">登录</a>#}
{#                    </li>#}
{#                    <li class="nav-item">#}
{#                        <a class="nav-link" href="{% url 'register' %}">注册</a>#}
{#                    </li>#}
{#                    {% endif %}#}
{#                </ul>#}
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        {% if messages %}
            {% for message in messages %}
                <div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
                    {{ message }}
                    <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                </div>
            {% endfor %}
        {% endif %}

        {% block main %}
        {% endblock %}
    </div>

    <footer class="bg-light text-center text-muted py-4 mt-5">
        <div class="container">
            <p>© 2025 每日美食选择器 - 记录美好食光,yjy提供</p>
        </div>
    </footer>




    <script src="{% static 'js/jquery-3.7.1.min.js' %}"></script>
{#    <script src="{% static 'js/bootstrap-3.4.1-dist/js/bootstrap.min.js' %}"></script>#}
    <script src="{% static 'js/bootstrap-5.1.3-dist/js/bootstrap.min.js' %}"></script>
{#    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>#}
    {% block js %}

      {% endblock %}
</body>
</html>






